package com.zhongli.devplatform.controller.sys;

import com.zhongli.devplatform.bean.Res;
import com.zhongli.devplatform.po.common.ReadSchoolPO;
import com.zhongli.devplatform.service.imp.sys.ReadSchoolService;
import com.zhongli.devplatform.utils.BeanCopierUtil;
import com.zhongli.devplatform.vo.sys.SchoolVO;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author wy
 * @since 2020/8/25
 */
@Api(tags = "查询学校", description = "查询学校", value = "查询学校")
@RestController
@RequestMapping("/school")
public class SchoolController {

    @Resource
    private ReadSchoolService schoolService;

    @GetMapping
    private Res<List<SchoolVO>> getAllSchool(){
        List<ReadSchoolPO> list = schoolService.list();
        List<SchoolVO> data = BeanCopierUtil.copy(list, SchoolVO.class);
        return Res.ok(data);
    }

}
